<?php

namespace app\common\services;


use yii\helpers\Url;

class UrlServices
{
    public static function buildWebUrl($path, $params = [])
    {
        $domain = \Yii::$app->params['domain'];
        $path = Url::toRoute(array_merge([$path], $params));

        return $domain['web'] . $path;
    }

    public static function buildMUrl($path, $params = [])
    {
        $domain = \Yii::$app->params['domain'];
        $path = Url::toRoute(array_merge([$path], $params));

        return $domain['m'] . $path;
    }

    public static function buildWWWUrl($path, $params = [])
    {
        $domain = \Yii::$app->params['domain'];
        $path = Url::toRoute(array_merge([$path], $params));

        return $domain['www'] . $path;
    }

    public static function buildNullUrl()
    {
        return "javascript:void(0)";
    }

    public static function buildImgUrl($bucket, $image_key)
    {
        $domain = \Yii::$app->params['domain'];
        $upload_config = \Yii::$app->params['uploads'];

        return $domain['www'] . $upload_config[$bucket] . '/' . $image_key;
    }
}
